import { h, defineComponent } from "@vue/runtime-core";
import startPageImg from "../../assets/bg.jpeg";
import buttonImg from "../../assets/button.png";
import { game } from "../Game";
export default defineComponent({
	props: ["msg"],
	setup(props, ctx) {
		const onClick = () => {
			console.log("已点击重启");
			ctx.emit("changePage", "GamePage");
		}
		return {
			onClick,
			msg: props.msg
		}
	},
	render(ctx) {
		// 返回虚拟结点
		return h("Container", [
			h("Sprite", { texture: startPageImg }),
			h("Sprite", {
				x: game.screen.width / 2,
				y: game.screen.height / 2,
				texture: buttonImg,
				interactive: true,
				onClick: ctx.onClick
			}, `${ctx.msg}请重新开始`)
		])
	}
})